//
// Created on 6/1/25.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef NEURONVIEW_VERTEX_H
#define NEURONVIEW_VERTEX_H
#include <vector>
#include <map>

enum class Format { GRAY, RGB, RGBA };
enum class Property { Vertex = 0, Normal = 1, Indices = 3, UV = 4, Color = 5 ,Other};

class PropertyTypeDef {
public:
    PropertyTypeDef() {}
    virtual ~PropertyTypeDef() {}
};
template <class T> class PropertyType : public PropertyTypeDef {
public:
    PropertyType() {}
    ~PropertyType() {
        std::vector<T>vectmp;
        m_Data.swap(vectmp);
    }
    int size(){return m_Size; }
    void addItem(T t){m_Data.push_back(t);m_Size=m_Data.size();}
    std::vector<T> m_Data;
    int m_Size=0;
};

class VertexProp {
public:
    VertexProp();
    ~VertexProp();
    void AddProperty(Property name, std::shared_ptr<PropertyTypeDef> prop);
    
    std::shared_ptr<PropertyTypeDef> GetProperty(Property name);
    std::map<Property, std::shared_ptr<PropertyTypeDef>> GetProperties();
private:
    std::map<Property, std::shared_ptr<PropertyTypeDef>>m_Properties;
    void *m_data = nullptr;
   
    Format m_PixelFormat = Format::GRAY;
};

#endif // NEURONVIEW_VERTEX_H
